//
//  YDEventsRedView.m
//  YDBASE
//
//  Created by rowena on 2019/10/15.
//  Copyright © 2019 wuyezhiguhun. All rights reserved.
//

#import "YDEventsRedView.h"

@implementation YDEventsRedView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor redColor];
    }
    return self;
}

/**
 * 响应事件遍历
 */
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {

    NSLog(@"wuyezhiguhun ->: YDEventsRedView ->: hitTest ");

    if (self.hidden || !self.userInteractionEnabled || self.alpha < 0.01 || ![self pointInside:point withEvent:event]) {
        return nil;
    } else {
        for (UIView *subview in [self.subviews reverseObjectEnumerator]) {
            UIView *hitView = [subview hitTest:[subview convertPoint:point fromView:self] withEvent:event];
            if (hitView) {
                return hitView;
            }
        }
        return self;
    }
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
